package com.zerui.manager.common.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author wh
 * @create_time 2023-08-23 15:28
 */
@Data
@ApiModel("分页参数对象")
public abstract class BasePageParam implements Serializable {

    private static final long serialVersionUID = -3263921252635611410L;

    @ApiModelProperty(value = "页码,默认为1", example = "1")
    private Integer pageIndex = 1;

    @ApiModelProperty(value = "页大小,默认为10", example = "10")
    private Integer pageSize = 10;


    public void setPageIndex(Integer pageIndex) {
        if (pageIndex == null || pageIndex <= 0) {
            this.pageIndex = 1;
        } else {
            this.pageIndex = pageIndex;
        }
    }

    public void setPageSize(Integer pageSize) {
        if (pageSize == null || pageSize <= 0) {
            this.pageSize = 10;
        } else {
            this.pageSize = pageSize;
        }
    }

}

